<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Hello World JSX</title>
</head>
<body>
  <div id="app"></div>
  <script type="text/javascript" src="../js/react.js"></script>
  <script type="text/javascript" src="../js/react-dom.js"></script>
  <script type="text/javascript" src="../babel/browser.js"></script>
  <script type="text/babel">

    var header = ["Book","Author","Language"];
    var exceldata = [["Think in java","janmes","JAVA"],["C++ Permier","zhang san","C++"],["python编程思想","wang wu","python"]];

    var table = React.createClass({
      propTypes: {
        header: React.PropTypes.array,
        exceldata: React.PropTypes.array,
      },
      getInitialState: function() {
        return {
          header: this.props.header,
          exceldata: this.props.exceldata,
        }
      },

      render: function() {
        var state = this.state;
        var h = state.header;
        return (
          <table>
            <thead>
              <tr>
                {
                  state.header.map(function(title, idx) {
                    return <td key={idx}>{title}</td>
                  })
                }
              </tr>
            </thead>
          </table>
        )
      }
    });

    ReactDOM.render(
      React.createElement(table, {header: header, exceldata: exceldata}),
      document.getElementById("app")
    );
  </script>
</body>
</html>
